package cn.jiahua.test14;

import java.util.concurrent.ArrayBlockingQueue;

public class Test2 {

    /**
     * 等待，阻塞等待
     * @param args
     */
    public static void main(String[] args) throws InterruptedException {


        //队列大小
        ArrayBlockingQueue blockingQueue=new ArrayBlockingQueue(3);

        //放元素
        blockingQueue.put("a") ;
        blockingQueue.put("b") ;
        blockingQueue.put("c") ;

        System.out.println(blockingQueue.take());
        blockingQueue.put("d") ;
        System.out.println(blockingQueue.take());
        System.out.println(blockingQueue.take());
        System.out.println(blockingQueue.take());



    }
}
